#include <bits/stdc++.h>

#define in read()
#define fi first
#define se second
#define pb push_back
#define y1 y_alpha_1

using namespace std;

using ll = long long;
using db = double;
using vec = vector<int>;
using pii = pair<int,int>;

int read() {
	int x = 0; bool f = 0; char ch = getchar(); while(!isdigit(ch)) f |= ch == '-',ch = getchar();
	while(isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48),ch = getchar(); return f ? -x : x;
}

const int N = 1e5 + 10;
const int mod = 998244353;

int f[N][110],a[N],p[N][110],n,s[N],K,len;

int upd(int x) { return x + (x >> 31 & mod); }

int main() {
#ifndef ONLINE_JUDGE
	freopen("1.in","r",stdin);
#endif
	n = in; K = in; len = in; f[0][0] = 1; s[0] = 1;
	for(int i = 1;i <= n;i++) a[i] = in;
	for(int i = 1;i <= n;i++) {
		for(int j = 1;j <= K;j++)
			if(a[i] == -1) {
				p[i][j] = p[i - 1][j] + 1;
			} else if(a[i] == j) p[i][j] = p[i - 1][j] + 1;
		for(int j = 1;j <= K;j++)
			if(a[i] == -1 || j == a[i]) {
				f[i][j] = s[i - 1]; if(p[i][j] >= len) f[i][j] = upd(f[i][j] - s[i - len]),f[i][j] = upd(f[i][j] + f[i - len][j] - mod);
			}
		for(int j = 1;j <= K;j++) s[i] = upd(s[i] + f[i][j] - mod);
	}
	printf("%d\n",s[n]);	
	return 0;
}
